package com.zjitc.controller;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.zjitc.po.JsonDate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/27 16:06
 * @description:
 */
@Controller
@RequestMapping("/json")
public class JsonController {

  private static final Gson GSON = new GsonBuilder().create();

  @RequestMapping("/auto")
  @ResponseBody
  public String auto(){
    JsonDate jsonPo = new JsonDate();
    jsonPo.setMsg("error");
    jsonPo.setState(1);
    return GSON.toJson(jsonPo);
  }
}
